package select_order;

class Test {
    public static void main(String[] args) {
//        int[] arry = {5, 4, 3, 2, 1};
        int[] arry = {1, 3, 5, 6, 3, 7, 8, 2, 6, 7, 7, 5, 4, 4, 5, 5, 5, 44};
        int length = arry.length;
        for (int i = 0; i < length; i++) {
            //选一个最小的数后，在交换位置
            int min = Integer.MIN_VALUE;
            int index = i;
            for (int j = i; j < length; j++) {
                if (min > arry[j]) {
                    min = arry[j];
                    index = j;
                }
            }
            //交换位置
            int temp = arry[index];
            arry[index] = arry[i];
            arry[i] = temp;
        }
        for (int i :
                arry) {
            System.out.printf("%d ", i);
        }
    }
}

//选择排序
public class Solution {


}
